<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./vue.js"></script>
</head>
<body>
  <div id="app">
    <home></home>
    <hr>
    <news></news>
  </div>
  <script>
    let CommonTitle = {
      template:`
        <div>
          <h2>我是子组件</h2>
         
          下面结构在不同的组件中使用 不一样
          <slot></slot>
        </div>
      `
    }
    let Home = {
      template:`
        <div>
          home页内容 
          <common-title>
              <h5>
                我是插槽对应的内容  
              </h5>
              <p>aaa</p>
          </common-title>
        </div>
      `,
      components:{
        CommonTitle
      }
    }
    let News = {
      template:`
        <div>
          news页内容  
          <common-title>
            <button>按钮</button>  
          </common-title>
        </div>
      `,
      components:{
        CommonTitle
      }
    }
    let vm = new Vue({
      el:"#app",
      components:{
        Home,
        News
      }
    })
  </script>
</body>
</html>